package org.jeecg.common.system.api.fallback;

import com.alibaba.fastjson.JSONObject;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.dto.message.MsgDTO;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ApiCenterFeign;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 进入fallback的方法 检查是否token未设置
 */
@Slf4j
public class ApiCenterFeignFallback implements ApiCenterFeign {

    @Setter
    private Throwable cause;

    @Override
    public Result<JSONObject> sendAnnouncement(MsgDTO msgDTO, @RequestHeader MultiValueMap<String, String> headers) {
        log.error("feign接口: 待办接口调用失败", cause);
        return Result.OK("待办接口调用失败");
    }

    @Override
    public Result<JSONObject> msgReadedAnnouncement(JSONObject jsonObject, @RequestHeader MultiValueMap<String, String> headers) {
        log.error("feign接口: 待办签阅调用失败", cause);
        return Result.OK("待办签阅接口调用失败");
    }
}
